import React, { Component } from 'react';
import { Button, WhiteSpace } from 'antd-mobile';
import { connect } from 'dva';
import DataList from '../../components/DataList1';

@connect(({ supervisionWorkList, loading }) => ({
  supervisionWorkList,
  loading: loading.models.list,
}))
class SupervisionWork extends Component {
  constructor(props){
    super(props);
    this.state ={
      list: this.props.supervisionWorkList.list,
    };
  }
  componentDidMount(){
    this.getList();
  }

  componentWillReceiveProps(nextProps){
    this.setState({
      list: nextProps.supervisionWorkList.list,
    })
  }
  getList = () => {
    this.props.dispatch({
      type:'supervisionWorkList/getlist',
      payload:[],
    })
  }

  render() {
    let listTitle = [
      {
        score: '分值',
      },
      {
        days_remaining: '剩余天数',
      },
      {
        oper: '操作',
      },
    ]
    return (
      <div>
        <WhiteSpace size='lg' />
        <div>督查工作： 评价指标</div>
        <WhiteSpace size='lg' />
        <DataList List={this.state.list} Props={this.props} DataTitle={listTitle} />
      </div>
    );
  }
}
export default SupervisionWork;
